package com.brspace.qualitycontrol.controller.admin;


import com.brspace.qualitycontrol.entity.vo.PerAddRoleVo;
import com.brspace.qualitycontrol.service.PermissionService;
import com.brspace.qualitycontrol.service.RolePermissionRelationService;
import com.brspace.qualitycontrol.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 权限表 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-04-21
 */
@Api(description = "权限控制器")
@CrossOrigin
@RestController
@RequestMapping("/admin/permission")
public class PermissionController {
    @Resource
    private PermissionService permissionService;
    @Resource
    private RolePermissionRelationService rolePerService;
    /**
     * 权限列表
     * @Author: wangt
     * @Date: 2021-04-21 09:54:21
     */
    @ApiOperation("权限列表")
    @GetMapping("list")
    public R list(){
        return R.ok().data("",permissionService.list());
    }
    /**
     * 给角色分配权限
     * @Author: wangt
     * @Date: 2021-04-21 15:05:14
     */
    @ApiOperation("给角色分配权限")
    @PostMapping("add")
    public R roleAddPer(@RequestBody  PerAddRoleVo perAddRoleVo){
        rolePerService.add(perAddRoleVo);
        return R.ok();
    }
}

